import java.util.EnumSet;
import com.wittams.gritty.Style.Option;
import com.wittams.gritty.Style;
import com.wittams.gritty.StyleState;
import java.awt.Color;
import com.wittams.gritty.swing.GrittyTerminal;



actions{
	action(id: "pasteAction",
			name: "Paste",
			//mnemonic: "P",
			enabled: true,
			//accelerator: shortcut("P"),
			closure: {
			    terminalPanel.termPanel.pasteSelection()
            })
}
def style = new Style(new Color(new Integer(model.settings.foregroundcolor)), 
		new Color(new Integer(model.settings.backgroundcolor)), EnumSet.noneOf(Option.class))


panel( new GrittyTerminal(style), id:'terminalPanel', 
		constraints: "grow",background: new Color(new Integer(model.settings.backgroundcolor)) ) {
}

def popupMenu=  popupMenu(id:'terminalPopupMenu')
{
	menuItem( pasteAction )
	separator()
	menuItem( app.views.Sshiffon.sftpAction )
	menuItem( app.views.Sshiffon.configAction )
	separator()
	menuItem( app.views.Sshiffon.disconnectAction )
}
terminalPanel.termPanel.addMouseListener({ e -> if (e.isPopupTrigger()) { popupMenu.show(e.getComponent(), e.getX(), e.getY());} } as java.awt.event.MouseAdapter)